package com.aim.common.exception;

import com.aim.common.enums.BizExceptionEnum;
import com.aim.common.enums.ExceptionEnum;

/**
 * @AUTO 服务异常
 * @Author AIM
 * @DATE 2019/4/19
 */
public class ServiceException extends RuntimeException {

	private Integer code;
	private String msg;

	public ServiceException(Integer code, String errorMessage) {
		super(errorMessage);
		this.code = code;
		this.msg = errorMessage;
	}

	public ServiceException(ExceptionEnum exception) {
		super(exception.getMessage());
		this.code = exception.getCode();
		this.msg = exception.getMessage();
	}

	public ServiceException(BizExceptionEnum exception) {
		super(exception.getMessage());
		this.code = exception.getCode();
		this.msg = exception.getMessage();
	}

	public Integer getCode() {
		return this.code;
	}

	public void setCode(Integer code) {
		this.code = code;
	}

	public String getErrorMessage() {
		return this.msg;
	}

	public void setErrorMessage(String errorMessage) {
		this.msg = errorMessage;
	}
}
